(function () {


    /*图表*/
    var initEchart = function (id,x,y) {
        var myChart = echarts.init(document.getElementById(id));
        var option = {
            xAxis: {
                type: 'category',
                data: x
            },
            yAxis: {
                type: 'value',
                name: '吞吐量（万吨）'
            },
            series: [{
                data: y,
                type: 'bar'
            }]
        };
        myChart.setOption(option);
    }
    var allcountrydata = JSON.parse($('#all').attr('data'))
    var maincountrydata = JSON.parse($('#main').attr('data'))

    initEchart('all',
        allcountrydata.map(_=>_.port),
        allcountrydata.map(_=>_.throughput)
    )
    initEchart('main',
        maincountrydata.map(_=>_.port),
        maincountrydata.map(_=>_.throughput)
    )
   
})()
